Creation of style sets

The following code demonstrates processes of creation of styles set, and addition of two styles to a set. After these operations are completed, the styles are applied to the report.

var

Style: TfrxStyleItem;

Styles: TfrxStyles;

Styles := TfrxStyles.Create( nil );

{ the first style }

Style := Styles.Add;

Style.Name := 'Style1';

Style.Font.Name := 'Courier New';

{ the second style }

Style := Styles.Add;

Style.Name := 'Style2';

Style.Font.Name := 'Tahoma';

Style.Frame.Typ := [ftLeft, ftRight];

{ apply a set to the report }

frxReport1.Styles := Styles;

You can create and use a set in a different way:

var

Style: TfrxStyleItem;

Styles: TfrxStyles;

Styles := frxReport1.Styles;

Styles.Clear;

{ the first style }

Style := Styles.Add;

Style.Name := 'Style1';

Style.Font.Name := 'Courier New';

{ the second style }

Style := Styles.Add;

Style.Name := 'Style2';

Style.Font.Name := 'Tahoma';

Style.Frame.Typ := [ftLeft, ftRight];

{ apply a set to the report }

frxReport1.Styles.Apply;